//============================================================================
// Name        : xyne.cpp
// Author      : dfoelber
// Description : This main file will be just an entry point later.
//				 For now, it will contain test code from the awesome SDL
//				 tutorials at http://lazyfoo.net/SDL_tutorials/index.php
//============================================================================

//@Include: object.h
//@Include: image_manager.h
//@Include: graphics/surface.h
//@Include: graphics/screen.h
//@Include: physics/area.h
//@Include: physics/path.h
//@Include: effect/region_effect.h

// INCLUDES //
#include "application.h"
#include "SDL/SDL_thread.h"
#include <string>
//////////////

// DEFINES //
#define FULLSCREEN "fullscreen"
/////////////

int run_thread(void *unused)
{
	Application::GetManager()->Run();
	
    return(0);
}

/**
* Xyne's entry point. 
**/
int main( int argc, char* args[] )
{	
	for( int i = 0; i < argc; i++ )
	{
		if( string(args[i]).find(FULLSCREEN) != string::npos )
		{
			Application::GetManager()->SetFullscreen(
				string(args[i]).find("true") != string::npos ? true : false );
		}
	}
	
	// Load everything
	if( !Application::GetManager()->Load() )
		return 1;
	
	// maybe later?
	/*SDL_Thread *thread;
	
	thread = SDL_CreateThread(run_thread, NULL);
	
	SDL_WaitThread(thread, NULL);*/
	// for now ..
	Application::GetManager()->Run();
    
	return 0;
}

